package com.huaxin.device.dto.request;

import com.huaxin.device.dto.enums.validation.ValidConnectionType;
import com.huaxin.device.dto.enums.validation.ValidEquipmentType;
import com.huaxin.device.dto.enums.validation.ValidPhaseCount;
import com.huaxin.device.dto.enums.validation.ValidVoltageLevel;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;

import java.math.BigDecimal;

@Data
public class EquipmentConnectionsUpdateReqDTO {

    @NotBlank(message = "ID不能为空")
    @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "conn_001")
    private String id;

    @Schema(description = "起点设备类型：Transformer, Cabinet, Switchgear, Generator, UPS, PDU, Meter, Sensor, Busway, DistributionBox, CapacitorBank, Motor, LightingPanel, TransferSwitch, SurgeProtector", requiredMode = Schema.RequiredMode.REQUIRED, example = "Transformer")
    @NotBlank(message = "起点设备类型不能为空")
    @ValidEquipmentType
    private String fromEquipmentType;

    @Schema(description = "起点设备ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "eq123e456-789a-bcde-f012-3456789abcde")
    @NotBlank(message = "起点设备ID不能为空")
    private String fromEquipmentId;

    @Schema(description = "终点设备类型：Transformer, Cabinet, Switchgear, Generator, UPS, PDU, Meter, Sensor, Busway, DistributionBox, CapacitorBank, Motor, LightingPanel, TransferSwitch, SurgeProtector", requiredMode = Schema.RequiredMode.REQUIRED, example = "Cabinet")
    @NotBlank(message = "终点设备类型不能为空")
    @ValidEquipmentType
    private String toEquipmentType;

    @Schema(description = "终点设备ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "cb123e456-789a-bcde-f012-3456789abcde")
    @NotBlank(message = "终点设备ID不能为空")
    private String toEquipmentId;

    @Schema(description = "连接类型：Cable, Busbar, Wire, Fiber, Conduit", example = "Cable")
    @ValidConnectionType
    private String connectionType;

    @Schema(description = "连接名称", example = "Main Feeder Cable-01")
    private String connectionName;

    @Schema(description = "电压等级：220V, 380V, 10KV, 20KV, 35KV, 110KV, 220KV", example = "10KV")
    @ValidVoltageLevel
    private String voltageLevel;

    @Schema(description = "线径", example = "3*120mm²")
    private String wireSize;

    @Schema(description = "长度（米）", example = "45.50")
    private BigDecimal length;

    @Schema(description = "相数：1/3", example = "3")
    @ValidPhaseCount
    private Integer phaseCount;

    @Schema(description = "备注", example = "主回路电缆连接")
    private String notes;
}